#include <iostream>
#include <cmath>
using namespace std;

int main() {
    int n;
    cin >> n;
    int a,b;
    int maxh = 0, h = 0;
    
    for (int i = 0; i < n; i++)
    {
        cin >> a >> b;
        if (a >= 90 && a <= 140 && b >= 60 && b <= 90)
        {
            h++;
            maxh = max(h, maxh);
        } else {
            h = 0;
        }
    }
    cout << maxh;
    
    return 0;
}